using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace ShipkaDefenders.Campaign
{
    public class Campaign
    {
    }
    public class Level
    {
        public string Name { get; set; }
        public string MiBackground { get { return NeededTextures[0]; } }
        public string MiForeground { get { return NeededTextures[1]; } }
        public List<Vector2> Banners { get; set; }
        public List<Vector2> Route { get; set; }
        protected string[] NeededTextures { get; set; }
        public void LoadTextures(AnaLogic g)
        {
            foreach (string s in NeededTextures)
            {
                Texture2D t = g.Content.Load<Texture2D>(string.Format("Campaign/{0}/{1}", Name, s));
                g.MapTextures[s] = t;
            }
        }
        public List<Gameplay.Ally> LoadBanners(AnaLogic g)
        {
            List<Gameplay.Ally> als = new List<Gameplay.Ally>();
            for (int k = 0; k < Banners.Count; k++)
            {
                als.Add(new Gameplay.Ally(g, k));
            }
            return als;
        }
        public void LoadCurveKeys(Gameplay.MotionPath mp)
        {
            float pos = 0.0f;
            for (int a = 0; a < Route.Count; a++)
            {
                mp.Keys.Add(new Gameplay.MotionPathKey(pos, Route[a]));
                if(a < Route.Count - 1)
                pos += Vector2.Distance(Route[a], Route[a + 1]) * 10;
            }
        }
    }
}
